package com.fc.happyteam.service.impl;

import com.fc.happyteam.dao.BoatDao;
import com.fc.happyteam.entity.BoatEntity;
import com.fc.happyteam.service.IBoatService;
import com.fc.happyteam.service.ISkuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Service("boatService")
@Transactional
public class BoatServiceImpl implements IBoatService {

    @Autowired
    private BoatDao boatDao;

    @Autowired
    private ISkuService skuService;

    @Override
    public BoatEntity getBoat(Long id) {
        return boatDao.getBoat(id);
    }

    @Override
    public BoatEntity queryObject(Long id) {
        return boatDao.queryObject(id);
    }

    @Override
    public List<BoatEntity> queryList(Map<String, Object> map) {
        return boatDao.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return boatDao.queryTotal(map);
    }

    @Override
    public void save(BoatEntity boat) {
        skuService.save(boat);
        boatDao.save(boat);
    }

    @Override
    public void update(BoatEntity boat) {
        boatDao.update(boat);
    }

    @Override
    public void delete(Long id) {
        skuService.delete(id);
        boatDao.delete(id);
    }

    @Override
    public void deleteBatch(Long[] ids) {
        boatDao.deleteBatch(ids);
    }
}
